package com.linghang.wusthelper.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author origin
 * 配置跨域请求
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")  //  拦截所有请求
                .allowedOrigins("*")
                .allowedMethods("POST", "GET")  //  仅支持post,get方法
                .maxAge(3600)
                .allowCredentials(true);// 允许证书
    }
}